package com.iv.durian.cloud.facade;


import com.iv.durian.cloud.Serve;
import com.iv.durian.cloud.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

@Component
@FeignClient(name = Serve.SERVICE_NAME)
@RequestMapping("/service/user")
public interface UserFacade {

    @RequestMapping(path = "/get/{userId}", method = RequestMethod.GET)
    User get(@PathVariable(value = "userId")Integer userId);

    @RequestMapping(value = "/getByMobileOrEmail/{mobileOrEmail}", method = RequestMethod.GET)
    User get(@PathVariable( "mobileOrEmail") String mobileOrEmail);

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    void add( User user);

    @RequestMapping(value = "/updatePassword/{userId}", method = RequestMethod.POST)
    void updatePassword( @PathVariable( "userId")Integer userId,@RequestParam("password")String password);

    @RequestMapping(value = "/updateTicket/{userId}", method = RequestMethod.POST)
    int updateTicket( @PathVariable("userId")int userId, @RequestParam("ticket")String ticket,@RequestParam( "expire")long expire);

    @RequestMapping(value = "/cleanTicket/{userId}", method = RequestMethod.GET)
    int cleanTicket( @PathVariable("userId")int id);

    @RequestMapping(value = "/getByTicket/{ticket}", method = RequestMethod.GET)
    User getByTicket(@PathVariable( "ticket")String ticket);
}
